Referring now to FIG. 1, when a lens is assembled to a camera, it is hard to ensure that an optical axis of the lens is perfectly perpendicular to an imaging sensor surface. Unless compensation is applied, this misalignment will cause geometrical distortion to any image produced by the lens.
In order to compensate for lens tilt, it must be properly modelled and the modelling parameters estimated.
Both Matlab Camera Calibration Toolbox and OpenCV refer to the distortion caused by lens tilt as “tangential distortion” and suggest that it can be corrected by the following set of equations:xdist=x+(2p1xy+p2(r2+2x2))ydist=y+(p1(r2+2y2)+2p2xy)
where xdist, ydist are the x,y coordinates of a pixel within an image distorted by a tilted lens; x, y are the normalised pixel coordinates;
r is the distance to the optical axis where r=√{square root over (x2+y2)}; and
p1, p2 are the modelling parameters.
However, according to Beauchemin et al., “Modelling and Removing Radial and Tangential Distortions in Spherical Lenses”, Multi-Image Analysis, 10th International Workshop on Theoretical Foundations of Computer Vision Dagstuhl Castle, Germany, Mar. 12-17, 2000, pp. 1-21 the above equations are based on thin prism distortion caused by the misalignment of the lens optical elements and are applicable only to spherical lenses. Thus, these equations may not be applicable in the case of lenses containing a large number of aspherical elements such as lens assemblies common in modern smartphones.